package com.ruoyi.web.controller.warning;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.warning.domain.query.CameraQuery;
import com.ruoyi.warning.service.ICameraService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 海康监控表 前端控制器
 * </p>
 *
 * @author chenhc
 * @since 2025-05-21
 */
@RestController
@RequestMapping("/camera")
@Api(tags = "海康监控", description = "用于处理海康监控相关操作的控制器")
public class CameraController {
    @Resource
    private ICameraService cameraService;

    @ApiOperation("获取配置下全部监控列表")
    @Log(title = "获取监控列表", businessType = BusinessType.SELECT)
    @GetMapping(value = "/getPage")
    public R getPage(CameraQuery query) {
        return R.ok(cameraService.getPage(query));
    }

    @ApiOperation("刷新监控列表")
    @Log(title = "刷新监控列表", businessType = BusinessType.OTHER)
    @GetMapping(value = "/refresh")
    public R refresh(CameraQuery query) {
        cameraService.refresh(query);
        return R.ok();
    }
}
